#! /usr/bin/env bash
myHERE=$(cd "$(dirname "$0")";pwd)
source "$myHERE/global_build_OSX.command"
mySetupBUILDDIR lemon
cd "$myBUILDDIR"
CC=/Applications/Développement/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
CFLAGS="-pipe -g -Wall -W -fPIE $myCFLAGS -DNDEBUG"
CCFLAGS="-stdlib=libstdc++"
INCPATH=-Ilemon
LINK=/Applications/Développement/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++
LFLAGS="$myLDFLAGS -headerpad_max_install_names"

SOURCE="${myHERE}/lemon/lemon.c"
OBJECT=lemon.o
TARGET="$my3RDBINDIR/lemon"

rm -f "${TARGET}"
"${CC}" -c ${CFLAGS} ${INCPATH} -o "${OBJECT}" "${SOURCE}"
"${LINK}" ${LFLAGS} -o "${TARGET}" "${OBJECT}"
"${TARGET}" -h

SOURCE="${myHERE}/lemonpp/mylemonpp.cc"
OBJECT=mylemonpp.o
TARGET="$my3RDBINDIR/mylemonpp"

rm -f "${TARGET}"
"${CC}" -c ${CCFLAGS} ${INCPATH} -o "${OBJECT}" "${SOURCE}"
"${LINK}" ${LFLAGS} -o "${TARGET}" "${OBJECT}"
"${TARGET}" -h

exit

SOURCE="${myHERE}/lemon/makeheaders.c"
OBJECT=makeheaders.o
TARGET="$my3RDBINDIR/makeheaders"

rm -f "${TARGET}"
"${CC}" -c ${CFLAGS} ${INCPATH} -o "${OBJECT}" "${SOURCE}"
"${LINK}" ${LFLAGS} -o "${TARGET}" "${OBJECT}"

